
import axios from 'axios';

/**
 * 材料
 */
export class MaterialService {
    // 分页查询列表
    static findMaterials (queryParams) {
        return axios({
            url: '/restaurant/material/Material/findMaterials',
            method: 'POST',
            data: queryParams
        });
    }

    //根据ID查询指定的材料
    static findMaterial (materialId) {
        const query = {
            materialId
        }
        return axios({
            url: '/restaurant/material/Material/findMaterial',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的材料(包含外键名称)
    static findMaterialForView (materialId) {
        const query = {
            materialId
        }
        return axios({
            url: '/restaurant/material/Material/findMaterialForView',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的材料(包含外键名称)
    static findMaterialForEdit (materialId) {
        const query = {
            materialId
        }
        return axios({
            url: '/restaurant/material/Material/findMaterialForEdit',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的材料(只提取ID 和 Name)
    static findMaterialsWithIdNameById (materialId) {
        const query = {
            materialId
        }
        return axios({
            url: '/restaurant/material/Material/findMaterialsWithIdNameById',
            method: 'POST',
            params: query,
        });
    }

    //根据名称查询材料集合(只提取ID 和 Name)
    static findMaterialsWithIdNameByName (materialName) {
        const query = {
            materialName
        }
        return axios({
            url: '/restaurant/material/Material/findMaterialsWithIdNameByName',
            method: 'POST',
            params: query,
        });
    }

    //新增保存材料
    static saveMaterial (material) {
        const query = {}
        return axios({
            url: '/restaurant/material/Material/saveMaterial',
            method: 'POST',
            params: query,
            data: material
        });
    }

    //修改保存材料
    static updateMaterial (material) {
        const query = {}
        return axios({
            url: '/restaurant/material/Material/updateMaterial',
            method: 'POST',
            params: query,
            data: material
        });
    }

    //根据ID查询指定的材料(只提取ID 和 Name)
    static deleteMaterial (materialId) {
        const query = {
            materialId
        }
        return axios({
            url: '/restaurant/material/Material/deleteMaterial',
            method: 'POST',
            params: query,
        });
    }
}
